package com.qianji.service.impl;

import cn.hutool.core.date.DateTime;
import com.qianji.mapper.IntegralMapper;
import com.qianji.service.IntegralService;
import com.qianji.vo.IntegralAddVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by 阳家桂 on 2021/3/12 15:38
 */
@Service
public class IntegralServiceImpl implements IntegralService {
    @Autowired
    private IntegralMapper integralMapper;

    /**
     * 添加积分
     * @param integralAddVO
     * @return
     */
    @Override
    public Integer addIntegral(IntegralAddVO integralAddVO) {
            integralAddVO.setCreateTime(new DateTime());
            integralAddVO.setStatus(0);//新增默认状态为0
            return integralMapper.addIntegral(integralAddVO);
    }


    /**
     * 删除积分
     * @param id
     * @return
     */
    @Override
    public Integer deleteIntegral(String id) {
        return integralMapper.deleteIntegral(id);
    }
}
